<include file="Public/min-header" />
<div class="wrapper">
	<include file="Public/breadcrumb" />
	<section class="content">
		<div class="row">
			<div class="col-xs-12">
				<div class="box">
					<nav class="navbar navbar-default">
						<div class="collapse navbar-collapse">
							<div class="navbar-form pull-right margin">
								<a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
							</div>
						</div>
					</nav>

					<!--被选中企业 加工信息-->
					<div class="panel panel-default">
						<div class="panel-heading">
							<h3 class="panel-title text-center">加工信息</h3>
						</div>
						<div class="panel-body">
							<table class="table table-bordered">
								<tbody>

									<if condition="$admin_info['admin_id'] eq 1 ">
										<tr>
											<td class="text-center">工序名称:</td>
											<td class="text-center">交货日期:</td>
											<td class="text-center">工序备注:</td>
											<td class="text-center">加工状态:</td>
											<td class="text-center">微企:</td>
											
											<td class="text-center">检验操作:</td>

											

										</tr>
										<else/>
										<tr>
											<td class="text-center">工序名称:</td>
											<td class="text-center">交货日期:</td>
											<td class="text-center">工序备注:</td>
											<td class="text-center">加工状态:</td>

											<td class="text-center">状态操作</td>
											<td class="text-center">检验报告</td>


										</tr>
									</if>
									<foreach name="chartlist" item="value">

										<if condition="$admin_info['admin_id'] eq 1 ">
											<tr>
												<td class="text-center">{$value.gx_name}</td>
												<td class="text-center">{$value.time_delivery}</td>
												<td class="text-center">{$value.remark}</td>

												<td class="text-center">
														<input type="hidden" name="process_state" id="" value="0" />
														<if condition="$value['state'] eq 0 "> 未开始加工
															<elseif condition="$value['state'] eq 1" /> 开始加工
															<else/>加工完成</if>
													</td>
												<td class="text-center">{$value.qiyename}</td>
												<!-- <td class="text-center">
														<if condition="$value['inspection'] eq 0 and $value['state'] neq 2 "> 待加工完成
															<elseif condition="$value['inspection'] eq 0 and $value['state'] eq 2" /> 待检验
															<elseif condition="$value['inspection'] eq 1" /> 检验通过
															</if>
													</td> -->
												<td class="text-center">
													<if condition="$value['state'] eq 2 and $value['inspection'] eq 0 "> 	
														<a href="{:U('Admin/order/inspectionSave',array('chart_number'=>$value['chart_number'],'order_sn' =>$value['order_sn'],'gx_name' =>$value['gx_name'] ))}" data-toggle="tooltip" class="btn btn-danger" title="">检验通过按钮</a></td>
															
													<elseif condition="$value['inspection'] eq 1" /> 已检验通过
													<elseif condition="$value['state'] neq 2" /> 待加工完成
												</if>
										
													</td>


												
											</tr>
											<else/>
											<form id="form{$key+1}">
												<tr>
													<input type="hidden" name="figure_number" value="{$value.figure_number}" />
													<input type="hidden" name="order_sn" id="" value="{$value.order_sn}" />
													<input type="hidden" name="company_name" id="" value="{$value.qiyename}" />
													<td class="text-center">
														<input type="hidden" name="gx_name" id="" value="{$value.gx_name}" /> {$value.gx_name}
													</td>
													<td class="text-center">
														<input type="hidden" name="time_delivery" id="" value="{$value.time_delivery}" /> {$value.time_delivery}
													</td>
													<td class="text-center">
														<input type="hidden" name="remark" id="" value="{$value.remark}" /> {$value.remark}
													</td>
													<td class="text-center">
														<input type="hidden" name="process_state" id="" value="0" />
														<if condition="$value['state'] eq 0 "> 未开始加工
															<elseif condition="$value['state'] eq 1" /> 开始加工
															<else/>加工完成</if>
													</td>

													<td class="text-center">

														<if condition="$value['state'] eq 0 ">
															<!--													<a href="{:U('Admin/order/companies_process',array('order_id'=>$value['figure_number'],'gx_name'=>$value['gx_name'],'order_sn'=>$value['order_sn']))}" data-toggle="tooltip" title="开始加工" class="btn btn-primary" data-original-title="开始加工"><i class="fa fa-wrench"></i></a>
-->
															<a data-id="{$key+1}" data-toggle="tooltip" title="开始加工" class="btn btn-primary btn-upload" data-original-title="开始加工"><i class="fa fa-wrench"></i></a>
															<elseif condition="$value['state'] eq 1 "/>
															
														<a data-id="{$key+1}" data-toggle="tooltip" title="完成加工" class="btn btn-success btn-upload" data-original-title="完成加工"><i class="fa fa-check-square-o"></i></a>
														
														</if>
													</td>
												<td class="text-center">
														<input type="hidden" name="process_state" id="" value="0" />
														<if condition="$value['inspection'] eq 0 and $value['state'] neq 2 "> 待加工完成
															<elseif condition="$value['inspection'] eq 0 and $value['state'] eq 2" /> 待检验
															<elseif condition="$value['inspection'] eq 1" /> 检验通过
															</if>
													</td>
												<td class="text-center">

												</tr>
											</form>
										</if>
									</foreach>
								</tbody>

							</table>
						<!-- <if condition="$admin_info['admin_id'] eq '1' ">
						<div class="panel panel-default">
							<div class="panel-heading">
								<h3 class="panel-title text-center">检验加工结果</h3>
							</div>
							<div class="panel-body text-center">
								<if condition="$inspection eq '0' and  $q eq '1'">
									<a href="{:U('Admin/order/change_inspection',array('chart_number'=>$chartlist['0']['chart_number'],'order_sn' =>$chartlist['0']['order_sn'] ))}" data-toggle="tooltip" class="btn btn-danger" title="">通过检验</a>
									<elseif condition="$inspection eq '1'  "/>
									<h1/>已经通过检验
									<h1/>
								</if>
								<if condition ="$q eq '0' ">
									<h1/>等待工序全部加工完成
									<h1/>
								</if>
								
							</div>

	</if> -->

						</div>
					</div>
				
				</div>
			</div>
	</section>
	</div>
	
	<div class="modal fade bs-example-modal-sm" id="myModal_success" tabindex="-1">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-body">
      	  <h4 class="text-center">操作成功!</h4>
      </div>
      <div class="modal-footer">
      	
      	<a href="http://www.jiejiangpt.com/index.php/Admin/Order/spik_process/order_sn/{$chartlist[0]['order_sn']}/order_id/{$chartlist[0]['figure_number']}" type="button" class="btn btn-success btn-block" >确认</a>
     <!-- <a href="http://www.jiejiangpt.com/index.php/Admin/Order/skip" type="button" class="btn btn-success btn-block" >确认</a>-->
    
      </div>
    </div>
  </div>
</div>
	
	</body>
	<script>
		$('.btn-upload').on('click', function() {
			// 获取 第几个form
			var data = $(this)[0].dataset.id;
		
			$.ajax({
				type: "post",
				url: "http://www.jiejiangpt.com/index.php/Admin/order/companies_process",
				data: $('#form' + data).serializeArray(),
				success: function(data) {
					if(data == '1'){
						$('#myModal_success').modal('show');
					}
				},
				async: true
			});
		})
	</script>

	</html>